﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Text;

namespace LimpaGaragem.Framework
{
    public class Encryption
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public static string Encrypt(string strPassword)
        {
            byte[] sByBuf = Encoding.ASCII.GetBytes(strPassword);
            for (int nCtr = 0; nCtr < sByBuf.Length; nCtr++)
                sByBuf[nCtr] = Convert.ToByte(Convert.ToInt64(sByBuf[nCtr]) + 4);
            return strPassword = Encoding.ASCII.GetString(sByBuf);
        }

        public static string Decrypt(string strPassword)
        {
            byte[] sByBuf = Encoding.ASCII.GetBytes(strPassword);
            for (int nCtr = 0; nCtr < sByBuf.Length; nCtr++)
                sByBuf[nCtr] = Convert.ToByte(Convert.ToInt64(sByBuf[nCtr]) - 4);
            return strPassword = Encoding.ASCII.GetString(sByBuf);
        } 
    }
}
